package name.vaccari.matteo.tai.chat.util;
import java.util.ArrayList;
import java.util.List;

import name.vaccari.matteo.tai.chat.domain.Message;
import name.vaccari.matteo.tai.chat.domain.MessageRepository;


public class FakeRepository implements MessageRepository {
	
	private List<Message> messages = new ArrayList<Message>();
	private int howMany;

	public List<Message> getLatestMessages(int howMany) {
		this.howMany = howMany;
		return messages;
	}

	public void save(Message message) {
		messages.add(0, message);
	}

	public int messageCount() {
		return messages.size();
	}

	public String getMessage(int i) {
		return messages.get(i).getText();
	}
	
	public int howMany(){
		return this.howMany;
	}
	
	
}
